//
// Created by 123 on 2025/1/13.
//
#include "iostream"
#include "vector"
#include "algorithm"

class MyPrint{
public:
    void operator()(int val){
        std::cout << val << " ";
    }
};

void test(){
    std::vector<int> v1;
    std::vector<int> v2;
    for (int i = 0; i < 10; ++i) {
        v1.push_back(i);
        v2.push_back(i+1);
    }
    std::vector<int> vTarget;
    vTarget.resize(v1.size()+v2.size());
    //合并
    std::merge(v1.begin(),v1.end(),v2.begin(),v2.end(),vTarget.begin());
    std::for_each(vTarget.begin(),vTarget.end(),MyPrint());
    std::cout << std::endl;
    //反转
    std::reverse(vTarget.begin(),vTarget.end());
    std::for_each(vTarget.begin(),vTarget.end(),MyPrint());
    std::cout << std::endl;


}

int main159(){
    test();
    return 0;
}

